feat(esm): Make vitest an optional peerDep in packages/testing#378
feat(esm): Make vitest an optional peerDep in packages/testing#378
Conversation
✅ Deploy Preview for cedarjs canceled.
|
There was a problem hiding this comment.
Greptile Summary
This PR adds vitest as an optional peer dependency to the @cedarjs/testing package. The change is completing incomplete work from PR #355, which originally added vitest support to the testing package but failed to properly configure the dependency structure.
The testing package currently exports vitest-specific functionality through dedicated export paths (./api/vitest and ./web/vitest) and includes vitest plugins for API configuration. However, vitest was only listed in devDependencies, creating an inconsistent dependency structure. This change adds vitest as an optional peer dependency with version 3.2.4, following npm best practices for packages that provide optional integrations.
The dual dependency structure (keeping vitest in both devDependencies and peerDependencies) is intentional - devDependencies allows the package to be built and tested, while the optional peer dependency ensures vitest is available when users consume the vitest-specific features. This pattern allows users to install the testing package even if they don't use vitest, while ensuring proper functionality when vitest features are utilized.
PR Description Notes:
- The PR description appears to be cut off mid-sentence after "it should also have made"
Confidence score: 5/5
- This PR is extremely safe to merge with virtually no risk of production issues
- Score reflects a simple, well-understood dependency configuration change that follows established npm patterns
- No files require special attention as this is a straightforward package.json modification
1 file reviewed, no comments
When #355 added vitest support to the testing package it should also have made vitest a peer dependency. And that's what I had it be in #80. But I didn't want all Cedar apps to have to install vitest. It should really only be a peer dep for ESM apps. I didn't know how to handle it, so I just left it out of #355 while I thought about it.
I've now decided that the best way forward for now is to mark it as an optional peer dependency. It really isn't optional for ESM apps, but I think this is the best I can do.